package top.yudoge.dogeeditor.db.datasource

import top.yudoge.dogeeditor.db.objects.DataSourceConfig
import javax.sql.DataSource

/**
 * @author Yudoge
 * @since 2025/03/19
 *
 * DataSourceManager manage the multiple data sources.
 *
 * User can register multiple data sources to it. And use the identifier to get one data source
 */
interface DataSourceManager {

    /**
     * Register multiple data sources to the manager.
     * @param configs The data source configurations.
     */
    fun register(configs: List<DataSourceConfig>)

    /**
     * Get one JDBC data source by identifier.
     * @param identifier The identifier of the data source.
     * @return The data source. or null if not present
     */
    fun getDataSource(identifier: String): DataSource?

    /**
     * Get all identifier of current data sources
     */
    fun listDataSourceIdentifiers(): List<String>

    fun listDataSourceConfig(): List<DataSourceConfig>

}